package com.fatgirl.patterns.state.fusm
{
	import com.fatgirl.patterns.iterator.IIterator;
	import com.fatgirl.patterns.iterator.NullIterator;
	import com.fatgirl.patterns.state.IStateControl;
	
	/**
	 * 
	 * 模糊状态
	 * @author iceman
	 * 
	 */
	public class FuSMState extends AbsFuSMState
	{
		protected var m_activationLevel:Number;
		public function FuSMState(_type:int,_controller:IStateControl = null)
		{
			super(_type,_controller);
			m_activationLevel = 0;
		}
		/**
		 * 确定状态模糊激活水平 
		 * 业务需求必须覆盖重写
		 * @return 一个参考权值
		 * 
		 */
		public override function calculateActivation():Number
		{
			return m_activationLevel;
		}
		public override function checkLowerBound(_lbound:Number=0):void
		{
			if(m_activationLevel < _lbound)
			{
				m_activationLevel = _lbound;
			}
		}
		public override function checkUpperBound(_ubound:Number=1):void
		{
			if(m_activationLevel > _ubound)
			{
				m_activationLevel = _ubound;
			}
		}
		public override function checkBounds(_lb:Number=0, _ub:Number=1):void
		{
			checkLowerBound(_lb);
			checkUpperBound(_ub);
		}
		public override final function iterator(_type:String=null):IIterator
		{
			return new NullIterator;
		}
	}
}